package com.example.demo.time;

import cn.hutool.core.date.DateUtil;

import javax.sound.midi.Soundbank;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class TimeTest {
    public static void main(String[] args) throws Exception {
//        long timeMillis = System.currentTimeMillis();
//        System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
//        System.out.println(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli());
//        boolean flag = false;
//        long num = 1010L;
//        System.out.println(flag + Long.toString(num));
//        final LocalDateTime start = LocalDateTime.now();
//        Thread.sleep(2000);
//        final LocalDateTime end = LocalDateTime.now();
//        final Duration between = Duration.between(start, end);
//        System.out.println(between.toMillis());
        System.out.println(Integer.MAX_VALUE);

        System.out.println(System.currentTimeMillis());

        final Date date = new Date();
        System.out.println(date.getTime());

        String s = "123456";
        System.out.println(s.substring(0, s.length() - 1));

        Date date1 = new Date(1622626193 * 1000L);
        System.out.println(date1.getYear() + "," + date1.getMonth()+ "," + date1.getDay()+ "," + date1.getHours()+ "," + date1.getMinutes()+ "," + date1.getSeconds());

        System.out.println(DateUtil.year(date1));
        System.out.println(DateUtil.month(date1));
        System.out.println(DateUtil.dayOfMonth(date1));
        System.out.println(DateUtil.hour(date1, true));
        System.out.println(DateUtil.minute(date1));
        System.out.println(DateUtil.second(date1));
        System.out.println(DateUtil.monthEnum(date1).getValue());

        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date1));

//        DateUtil.isSameDay(new Date,)
    }
}
